" vim-plug
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
call plug#begin()
    Plug 'scrooloose/nerdtree'
    Plug 'itchyny/lightline.vim'
    Plug 'altercation/vim-colors-solarized'
    Plug 'rakr/vim-one'
    Plug 'joshdick/onedark.vim'
    Plug 'rust-lang/rust.vim'
    Plug 'bagrat/vim-buffet'
    Plug 'dart-lang/dart-vim-plugin'
    "Plug 'natebosch/vim-lsc'
    "Plug 'natebosch/vim-lsc-dart'
    "Plug 'thosakwe/vim-flutter'
    "Plug 'neoclide/coc.nvim', {'branch': 'release'}
    Plug 'honza/vim-snippets'
    Plug 'tomasr/molokai'
    Plug 'lotabout/skim', { 'dir': '~/.skim', 'do': './install' }
    Plug 'lotabout/skim.vim'
    Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
    Plug 'junegunn/fzf.vim'
    Plug 'autozimu/LanguageClient-neovim', {
        \ 'branch': 'next',
        \ 'do': 'bash install.sh',
        \ }
	Plug 'voldikss/vim-floaterm'
call plug#end()

filetype plugin indent on
" To ignore plugin indent changes, instead use:
" filetype plugin on

" NERDTree
map <F3> :NERDTreeToggle<CR>

set tabstop=4 
set softtabstop=4 
set shiftwidth=4 
set expandtab 
set nu 
set autoindent
set cindent
let &termencoding=&encoding
set number
set encoding=utf-8
set fileencodings=utf-8,gbk,gb18030,gk2312
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"language messages zh_CN.utf-8
set showmatch
set incsearch
set clipboard+=unnamed
set ruler
syntax enable

"colorscheme onedark
"colorscheme molokai

let g:one_allow_italics = 1

set guifont=Ubuntu\ Mono
let g:rustfmt_autosave=1
let g:buffet_show_index = 1

set mouse=a

nmap <F8> :TagbarToggle<CR>

" buffet
noremap <Tab> :bn<CR>
noremap <S-Tab> :bp<CR>
noremap <Leader><Tab> :Bw<CR>
noremap <Leader><S-Tab> :Bw!<CR>
noremap <C-t> :tabnew split<CR>

"""""""""""""""""""""""""""""""""""""""""""
" skim
"""""""""""""""""""""""""""""""""""""""""""
command! -bang -nargs=* Ag call fzf#vim#ag_interactive(<q-args>, fzf#vim#with_preview('right:50%:hidden', 'alt-h'))
command! -bang -nargs=* Rg call fzf#vim#rg_interactive(<q-args>, fzf#vim#with_preview('right:50%:hidden', 'alt-h'))

" language client
let g:LanguageClient_serverCommands = {
            \ 'rust': ['rust-analyzer'],
            \ }
nmap <silent>K <Plug>(lcn-hover)
nmap <silent> gd <Plug>(lcn-definition)
nmap <silent> <F2> <Plug>(lcn-rename)

" Maps leader to the spacebar
map <Space> <Leader>

""""""""""""""""""""""""""""""
" VIM-FLOATERM
""""""""""""""""""""""""""""""

let g:floaterm_open_command = 'tabe'


nnoremap   <silent>   <F9>    :FloatermNew --height=0.4 --width=0.98 --wintype=floating --position=bottom --autoclose=2 --title=
tnoremap   <silent>   <F9>    <C-\><C-n>:FloatermNew --height=0.4 --width=0.98 --wintype=floating --position=bottom --autoclose=2 --title=
nnoremap   <silent>   <F8>    :FloatermPrev<CR>
tnoremap   <silent>   <F8>    <C-\><C-n>:FloatermPrev<CR>
nnoremap   <silent>   <F10>    :FloatermNext<CR>
tnoremap   <silent>   <F10>    <C-\><C-n>:FloatermNext<CR>
nnoremap   <silent>   <F12>   :FloatermToggle<CR>
tnoremap   <silent>   <F12>   <C-\><C-n>:FloatermToggle<CR>
tnoremap   <silent>   <F11>   <C-\><C-n><CR>

nnoremap   <C-c><C-c> :FloatermSend<CR>
vnoremap   <C-c><C-c> :FloatermSend<CR>


